package com.ssy.lingxi.order.model.vo.basic.response;

import com.ssy.lingxi.order.entity.OrderDO;
import com.ssy.lingxi.order.utils.NumberUtil;
import lombok.Getter;
import lombok.Setter;

/**
 * 生成支付链接返回VO
 * @author wyx
 * @version 2.0.0
 * @date 2021-11-30
 */
@Setter
@Getter
public class GeneratePayLinkVO {
    /**
     * 订单Id
     */
    private Long orderId;

    /**
     * 订单编号
     */
    private String orderNo;

    /**
     * 订单来源商城Id
     */
    private Long shopId;

    /**
     * 订单来源商城的环境，1、Web 2、H5 3、小程序 4、App
     */
    private Integer shopEnvironment;

    /**
     * 订单来源商城名称
     */
    private String shopName;

    /**
     * 订单摘要
     */
    private String digest;

    /**
     * 订单商品总金额 = 商品单价 * 数量
     */
    private String productAmount;

    /**
     * 买方（采购）会员Id
     */
    private Long buyerMemberId;

    /**
     * 采购会员角色Id
     */
    private Long buyerRoleId;

    /**
     * 采购会员名称
     */
    private String buyerMemberName;

    public GeneratePayLinkVO(OrderDO order) {
        this.orderId = order.getId();
        this.orderNo = order.getOrderNo();
        this.shopId = order.getShopId();
        this.shopEnvironment = order.getShopEnvironment();
        this.shopName = order.getShopName();
        this.digest = order.getDigest();
        this.productAmount = NumberUtil.formatAmount(order.getProductAmount());
        this.buyerMemberId = order.getBuyerMemberId();
        this.buyerRoleId = order.getBuyerRoleId();
        this.buyerMemberName = order.getBuyerMemberName();
    }
}
